package main.java.state.after;

public class Context {
    //定义4个状态常量
    public static final OpenningState OPENNING_STATE = new OpenningState();
    public static final ClosingState CLOSING_STATE = new ClosingState();
    public static final RunningState RUNNING_STATE = new RunningState();
    public static final StoppingState STOPPING_STATE = new StoppingState();

    private LiftState liftState;

    public LiftState getLiftState() {
        return liftState;
    }

    public void setLiftState(LiftState liftState) {
        this.liftState = liftState;
        this.liftState.setContext(this);
    }

    void opne() {
        this.liftState.opne();
    }

    void close() {
        this.liftState.close();
    }

    void run() {
        this.liftState.run();
    }

    void stop() {
        this.liftState.stop();
    }
}
